{template /common/header} 
<script type="text/javascript">
var obj_right="做单记录";
var obj_rightlink="/index.php?m=user&c=order&a=orderaddjiluscore";
</script>
<ul class="app_zuodanList">
  <li><a href="{U('order/orderadd')}">线下做单</a></li>
  <li><a href="{U('order/orderaddscore')}">积分做单</a></li>
  <div class="lc_arrow" style="left:50%"><b></b></div>
</ul>
<form action="{U('User/order/doorderadd')}" method="post" name="doorder" class="doorder"  onkeydown="if(event.keyCode==13)return false;">
  <input type="hidden" name="oid" id="oid" value="<?php echo $_GET["oid"]==""?"0000":$_GET["oid"];?>" />
<div class="zuodanInfo">
  <div class="app_userContentTitle"> 第一步：输入消费会员手机号，并核对会员信息 </div>
  <div class="app_zdInfo"> <span>购物会员手机号码：</span>
    <input type="text" name="user_mobi" id="user_mobi" placeholder="请输入消费会员手机号码"   style="width:40%;"  autocomplete="off"  datatype="m" errormsg="消费会员手机号码不正确" ajaxurl="{U('User/order/checkuser')}"  nullmsg='请输入消费会员手机号码'/>
    <a href="javascript:void(0);"  autocomplete="off"  class="send_code">免费获取验证码</a>
  </div>
  <div class="app_zdInfo"> <span>购物订单号：</span>
    <input type="text" name="payorder" id="payorder" value="<?php echo substr(time(),6).$this->userid.rand(1000,9999);?>" placeholder="购物订单号"  autocomplete="off"   datatype="*" errormsg="请输入购物订单号" nullmsg='请输入购物订单号' ajaxurl="{U('User/order/checkorder')}" />
  </div>
  <div class="app_zdInfo"> <span>消费会员短信验证码：</span>
    <input type="text" name="code" id="code" placeholder="消费会员短信验证码" autocomplete="off"   datatype="*" errormsg="消费会员短信验证码" nullmsg='消费会员短信验证码' ajaxurl="{U('User/order/checkcode')}" />
  </div>
  <div class="app_zdInfo"> <span>消费会员帐号：</span>
    <input type="text" name="user_name" id="user_name"  autocomplete="off"  placeholder="输入会员手机号码后自动获取会员信息" readonly="readonly" style="background:#ebebe4" errormsg="没有您填写的会员" nullmsg='请输入购物会员帐号'/>
  </div>
  <div class="app_zdInfo"> <span>消费会员姓名：</span>
    <input type="text" name="real_name" id="real_name"  autocomplete="off"  placeholder="输入会员手机号码后自动获取会员信息" readonly="readonly" style="background:#ebebe4" adatatype="*2-4" errormsg="请正确输入会员姓名" nullmsg='请输入购物会员姓名'/>
  </div>
  <div class="app_userContentTitle"> 第二步：录入消费信息 </div>
  <div class="app_zdInfo"> <span>购物所需<?php echo C('site_integralname')?>：</span>
    <input type="text" name="money" id="money"  autocomplete="off"  placeholder="请输入购物<?php echo C('site_integralname')?>" datatype="*" errormsg="请输入购物<?php echo C('site_integralname')?>" nullmsg='请输入购物<?php echo C('site_integralname')?>'/>
  </div>
  <div class="app_zdInfo"> <span>应付<?php echo C('site_integralname')?>：</span>
    <input type="text" name="paymoney" id="paymoney"  autocomplete="off"  disabled="disabled" readonly="readonly" placeholder="实际应付<?php echo C('site_integralname')?>" />
  </div>
  <div class="app_zdInfo"> <span>商品信息：</span>
    <input type="text" name="productinfo" id="productinfo"  autocomplete="off"  placeholder="请输入商品数量"  datatype="*" errormsg="请输入商品信息" nullmsg='请输入商品信息'/>
  </div>
  <div class="app_zdInfo"> <span>商品数量：</span>
    <input type="text" name="pnum" id="pnum"  autocomplete="off"  placeholder="请输入商品数量"  datatype="n" errormsg="请输入商品数量" nullmsg='请输入商品数量'/>
  </div>
  <div class="app_zdInfo"> <span>二级密码：</span>
      <input type="password" name="pinpwd" id="pinpwd"  autocomplete="off" placeholder="请输入您的二级密码"  datatype="*" errormsg="请输入您的二级密码" nullmsg='请输入您的二级密码'/>
    </div>
  <div class="app_zdInfo" style="border:none;">
    <label>
      <input type="checkbox" checked="checked" readonly="readonly" />
      我已阅读并接受<span> <a href="javascript:void(0)" class="art_info_box">金商道商家做单须知</a></span></label>
  </div>
  <input class="app_zdSub" type="button" onclick="dosubmit();" value="立即做单" />
</div>
</form>

<div class="jftip" style="display:none">
  <div class="jftip_info">
    <p class="p01 p03">商家须知</p>
    <p class="p02">1.严禁销售非正品商品;</p>
    <p class="p02">2.严禁抬高价格，扣点转嫁消费会员;</p>
    <p class="p02">3.严禁虚假消费骗取积分赠送;</p>
    <p class="p02">4.严禁未经会员许可为其注册会员;</p>
    <p class="p02">5.严禁漏登会员的消费产品信息;</p>
    <p class="p02">违反以上任何一条，公司有权取消合作，如有疑问请</p>
    <p class="p02">拨打：<?php echo C('site_tel') ?></p>
  </div>
</div>
<style type="text/css">
.order_info_ck,.jftip_info{ line-height:24px;}
.order_info_ck font,.p03{ color:red; font-weight:bold;}
</style>
<script type="text/javascript">
$(function(){
	$(".art_info_box").click(function(){
		art.dialog({
			id: 'pay_error',
			title : '商家须知',
			fixed: true,
			lock: true,
			content: $(".jftip").html(),
			okVal:'我已阅读并同意',
			cancel:false,
			ok: function() {
			},
		});
	})	
	  $(".send_code").click(function(){
        var text=$(this).text();
        var type=$(this).attr("type");
        if(text!="免费获取验证码"){
            return false;
        }
		var mobile=$("#user_mobi").val();
		if(mobile==""){
			alert("请填写您的手机号码");
			$("#user_mobi").blur();
			return;
		}
		var money=$("#money").val();
	    if(money==""){
	      alert("请填写购物积分");
	      $("#money").blur();
	      return;
	    }
		$.ajax({url: "{U('User/Public/send_code')}&type=score&token={$_SESSION[send_code_time]}&money="+money+"&mobile="+mobile,timeout: 5000,cache: false,type: "get",async : false,dataType: "json",success: function (d) {
			if(d.status==1){
				 downtime(120);	
			}
			alert(d.info);
		}});
    })
})
/**

* 验证码倒计时

* time 倒计时时间：秒

**/

function downtime(time){

//循环调用

if(time == '0'){

$('.send_code').text('免费获取验证码');

}else{

time --;

$('.send_code').text('重新发送（'+time+'）');

setTimeout(function() {

downtime(time);

},1000);} 

}
$(function(){
	$('#user_mobi').bind("change",function(){
		var user_mobi=$("#user_mobi").val();
		var datas = {'user_mobi':user_mobi};
		$.ajax({
			url: "{U('User/order/checkuserscore')}",
			timeout: 5000,
			data:datas,
			cache: false,
			type: "post",
			dataType: "json",
			success: function (d) {
				if(d.status=="y"){
					$("#pay_points").val(d.infos.user_money);
					$("#real_name").val(d.infos.true_name==""?d.infos.username:d.infos.true_name);
					$("#user_name").val(d.infos.username);
				}
			}
		});	
	});
	$('#code').bind("change",function(){
		var user_mobi=$("#user_mobi").val();
		var code=$("#code").val();
		var datas = {'user_mobi':user_mobi,'code':code};
		$.ajax({
			url: "{U('User/order/checkuserscore')}",
			timeout: 5000,
			data:datas,
			cache: false,
			type: "post",
			dataType: "json",
			success: function (d) {
				if(d.status=="y"){
					$("#pay_points").val(d.infos.user_money);
					$("#real_name").val(d.infos.true_name==""?d.infos.username:d.infos.true_name);
					$("#user_name").val(d.infos.username);
				}
			}
		});	
	});
	$(".doorder").Validform({
		tiptype:3
	});
	$('#money').bind("change",function(){
		var money=parseFloat($(this).val());
		$("#paymoney").val(money)
	});
})
document.onkeydown = function(e){ 
    var ev = document.all ? window.event : e;
    if(ev.keyCode==13) {
    if($("#user_name").val()==""){return false;}
	if($("#real_name").val()==""){return false;}
	if($("#user_mobi").val()==""){return false;}
	if($("#money").val()==""){return false;}
	if($("#productinfo").val()==""){return false;}
	if($("#payorder").val()==""){return false;}
	if($("#pnum").val()==""){return false;}
	var text="会员帐号："+$("#user_name").val()+"<br>";
		text+="会员姓名："+$("#real_name").val()+"<br>";
		text+="手机号码："+$("#user_mobi").val()+"<br>";
		text+="购物金额："+$("#money").val()+"元<br>";
		text+="商品信息："+$("#productinfo").val()+"<br>";
		text+="订单号："+$("#payorder").val()+"<br>";
		text+="商品数量："+$("#pnum").val()+"<br>";
	art.dialog({
        id: 'pay_error',
        title : '提示信息',
        fixed: true,
        lock: true,
        content: text,
        okVal:'确认信息',
		cancelVal:'返回修改',
        ok: function() {
			 $("form[name=doorder]").submit();	
		},
		cancel:function() {}
    });
    }
}
function dosubmit() {
    if($("#user_name").val()==""){return false;}
	if($("#real_name").val()==""){return false;}
	if($("#user_mobi").val()==""){return false;}
	if($("#money").val()==""){return false;}
	if($("#productinfo").val()==""){return false;}
	if($("#payorder").val()==""){return false;}
	if($("#pnum").val()==""){return false;}
	var text="会员帐号："+$("#user_name").val()+"<br>";
		text+="会员姓名："+$("#real_name").val()+"<br>";
		text+="手机号码："+$("#user_mobi").val()+"<br>";
		text+="购物金额："+$("#money").val()+"元<br>";
		text+="订单号："+$("#payorder").val()+"<br>";
		text+="商品数量："+$("#pnum").val()+"<br>";
	art.dialog({
        id: 'pay_error',
        title : '提示信息',
        fixed: true,
        lock: true,
        content: text,
        okVal:'确认信息',
		cancelVal:'返回修改',
        ok: function() {
			 $("form[name=doorder]").submit();	
		},
		cancel:function() {}
    });
  
}

$(function(){
	$("input[type='text']").focus(function()
	{
		$(".app_head , .app_footNav").css("position","relative");
	});
	$("input[type='text']").blur(function()
	{
		$(".app_head , .app_footNav").css("position","fixed");
	});
});
</script>
{template /common/footer}